<template>
  <div>
    <div ref="editor" style="text-align:left"></div>
    <button v-on:click="getContent">查看内容</button>
  </div>
</template>

<script>
import E from 'wangeditor'
export default {
  name: 'editor',
  data () {
    return {
      editorContent: ''
    }
  },
  methods: {
    getContent: function () {
      alert(this.editorContent)
    }
  },
  mounted () {
    var editor = new E(this.$refs.editor)
    editor.customConfig.onchange = (html) => {
      this.editorContent = html
    }
    editor.customConfig.lang = {
      设置标题: 'title',
      正文: 'p',
      链接文字: 'link text',
      链接: 'link',
      上传图片: 'upload image',
      上传: 'upload',
      创建: 'init'
      // 还可自定添加更多
    }
    editor.create()
  }
}
</script>

<style scoped>
</style>
